package org.example.client.order.dto.cmd;

import com.alibaba.cola.dto.Command;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Positive;
import javax.validation.constraints.PositiveOrZero;

@EqualsAndHashCode(callSuper = true)
@Data
public class OrderItemCreateCmd extends Command {

    /**
     * 商品id
     */
    @NotNull(message = "商品id不能为空")
    private Long itemId;

    /**
     * 商品名称
     */
    @NotBlank(message = "商品名称不能为空")
    private String itemName;

    /**
     * 商品单价(单位：分)
     */
    @NotNull(message = "商品单价不能为空")
    @PositiveOrZero(message = "商品单价必须大于等于0")
    private Long itemPrice;

    /**
     * 数量
     */
    @NotNull(message = "数量不能为空")
    @Positive(message = "数量必须大于0")
    private Integer quantity;
}
